
	
/*------------------------------------------------------------------------------

	T.8 : Effect of SNED on teacher outcomes, school-level analysis

*/


global replica_dir="<add path to your working directory>"
global data_dir=	"$replica_dir/data"
global output_dir=	"$replica_dir/output"

use "$data_dir/slvl_fin.dta", clear  


/*---------------------------------------------------------------------------*/
	
**#	Multiple hypothesis testing
	
/*---------------------------------------------------------------------------*/


global depvars  "dropped newtea exp aep10" 
global indepvars "municip_tm1 rural_rbd_tm1 gender_tm1 tit_educ_tm1 permanent_tm1 tea_admin_tm1 multsch_tm1 i.sned_yr i.hg"


eststo clear
				
* ALL	
	
foreach yvar of global depvars{
	
eststo: reg `yvar'_tp1 `yvar'_tm1  treat25 st_ind25 st_ind25_sq inter25 inter25_sq  ${indepvars} if abs(st_ind25) <= 1.5 , vce(cluster rbd)
eststo: reg `yvar'_tp1 `yvar'_tm1  treat10 st_ind10 st_ind10_sq inter10 inter10_sq  ${indepvars} if abs(st_ind10) <= 1.5 , vce(cluster rbd)

}		


* Private
				 
foreach yvar of global depvars{
	
eststo: reg `yvar'_tp1 `yvar'_tm1  treat25 st_ind25 st_ind25_sq inter25 inter25_sq  ${indepvars} if abs(st_ind25) <= 1.5 & municip==0, vce(cluster rbd)
eststo: reg `yvar'_tp1 `yvar'_tm1  treat10 st_ind10 st_ind10_sq inter10 inter10_sq  ${indepvars} if abs(st_ind10) <= 1.5 & municip==0, vce(cluster rbd)

}		

* Municipal
				 
foreach yvar of global depvars{
	
eststo: reg `yvar'_tp1 `yvar'_tm1  treat25 st_ind25 st_ind25_sq inter25 inter25_sq  ${indepvars} if abs(st_ind25) <= 1.5 & municip==1, vce(cluster rbd)
eststo: reg `yvar'_tp1 `yvar'_tm1  treat10 st_ind10 st_ind10_sq inter10 inter10_sq  ${indepvars} if abs(st_ind10) <= 1.5 & municip==1, vce(cluster rbd)

}


rwolf2 ///
	(reg dropped_tp1  				treat25 st_ind25 st_ind25_sq inter25 inter25_sq  dropped_tm1  		${indepvars} if abs(st_ind25) <= 1.5 , vce(cluster rbd)) ///
	(reg dropped_tp1  				treat10 st_ind10 st_ind10_sq inter10 inter10_sq  dropped_tm1  		${indepvars} if abs(st_ind10) <= 1.5 , vce(cluster rbd)) /// 
	(reg newtea_tp1  				treat25 st_ind25 st_ind25_sq inter25 inter25_sq  newtea_tm1  		${indepvars} if abs(st_ind25) <= 1.5 , vce(cluster rbd)) ///
	(reg newtea_tp1  				treat10 st_ind10 st_ind10_sq inter10 inter10_sq  newtea_tm1  		${indepvars} if abs(st_ind10) <= 1.5 , vce(cluster rbd)) /// 
	(reg exp_tp1   					treat25 st_ind25 st_ind25_sq inter25 inter25_sq  exp_tm1   			${indepvars} if abs(st_ind25) <= 1.5 , vce(cluster rbd)) ///
	(reg exp_tp1   					treat10 st_ind10 st_ind10_sq inter10 inter10_sq  exp_tm1   			${indepvars} if abs(st_ind10) <= 1.5 , vce(cluster rbd)) /// 
	(reg aep10_tp1 	    			treat25 st_ind25 st_ind25_sq inter25 inter25_sq  aep10_tm1    		${indepvars} if abs(st_ind25) <= 1.5 , vce(cluster rbd)) ///
	(reg aep10_tp1      			treat10 st_ind10 st_ind10_sq inter10 inter10_sq  aep10_tm1    		${indepvars} if abs(st_ind10) <= 1.5 , vce(cluster rbd)) /// 
	(reg dropped_tp1  				treat25 st_ind25 st_ind25_sq inter25 inter25_sq  dropped_tm1  		${indepvars} if abs(st_ind25) <= 1.5  & municip==0, vce(cluster rbd)) ///
	(reg dropped_tp1  				treat10 st_ind10 st_ind10_sq inter10 inter10_sq  dropped_tm1  		${indepvars} if abs(st_ind10) <= 1.5  & municip==0, vce(cluster rbd)) /// 
	(reg newtea_tp1  				treat25 st_ind25 st_ind25_sq inter25 inter25_sq  newtea_tm1  		${indepvars} if abs(st_ind25) <= 1.5  & municip==0, vce(cluster rbd)) ///
	(reg newtea_tp1  				treat10 st_ind10 st_ind10_sq inter10 inter10_sq  newtea_tm1  		${indepvars} if abs(st_ind10) <= 1.5  & municip==0, vce(cluster rbd)) /// 
	(reg exp_tp1   					treat25 st_ind25 st_ind25_sq inter25 inter25_sq  exp_tm1   			${indepvars} if abs(st_ind25) <= 1.5  & municip==0, vce(cluster rbd)) ///
	(reg exp_tp1   					treat10 st_ind10 st_ind10_sq inter10 inter10_sq  exp_tm1  			${indepvars} if abs(st_ind10) <= 1.5  & municip==0, vce(cluster rbd)) /// 
	(reg aep10_tp1 	    			treat25 st_ind25 st_ind25_sq inter25 inter25_sq  aep10_tm1    		${indepvars} if abs(st_ind25) <= 1.5  & municip==0, vce(cluster rbd)) ///
	(reg aep10_tp1      			treat10 st_ind10 st_ind10_sq inter10 inter10_sq  aep10_tm1    		${indepvars} if abs(st_ind10) <= 1.5  & municip==0, vce(cluster rbd)) /// 
	(reg dropped_tp1  				treat25 st_ind25 st_ind25_sq inter25 inter25_sq  dropped_tm1  		${indepvars} if abs(st_ind25) <= 1.5  & municip==1, vce(cluster rbd)) ///
	(reg dropped_tp1  				treat10 st_ind10 st_ind10_sq inter10 inter10_sq  dropped_tm1  		${indepvars} if abs(st_ind10) <= 1.5  & municip==1, vce(cluster rbd)) /// 
	(reg newtea_tp1  				treat25 st_ind25 st_ind25_sq inter25 inter25_sq  newtea_tm1  		${indepvars} if abs(st_ind25) <= 1.5  & municip==1, vce(cluster rbd)) ///
	(reg newtea_tp1  				treat10 st_ind10 st_ind10_sq inter10 inter10_sq  newtea_tm1  		${indepvars} if abs(st_ind10) <= 1.5  & municip==1, vce(cluster rbd)) /// 
	(reg exp_tp1   					treat25 st_ind25 st_ind25_sq inter25 inter25_sq  exp_tm1   			${indepvars} if abs(st_ind25) <= 1.5  & municip==1, vce(cluster rbd)) ///
	(reg exp_tp1   					treat10 st_ind10 st_ind10_sq inter10 inter10_sq  exp_tm1   			${indepvars} if abs(st_ind10) <= 1.5  & municip==1, vce(cluster rbd)) /// 
	(reg aep10_tp1 	    			treat25 st_ind25 st_ind25_sq inter25 inter25_sq  aep10_tm1   		${indepvars} if abs(st_ind25) <= 1.5  & municip==1, vce(cluster rbd)) ///
	(reg aep10_tp1      			treat10 st_ind10 st_ind10_sq inter10 inter10_sq  aep10_tm1    		${indepvars} if abs(st_ind10) <= 1.5  & municip==1, vce(cluster rbd)) /// 
	, ///
	indepvars(  treat25, treat10,  /// 
				treat25, treat10,  ///
				treat25, treat10,  ///
				treat25, treat10,  ///
				treat25, treat10,  ///
				treat25, treat10,  /// 
				treat25, treat10,  ///
				treat25, treat10,  ///
				treat25, treat10,  /// 
				treat25, treat10,  ///
				treat25, treat10,  ///
				treat25, treat10  ///
				) seed(12011303)  cluster(rbd) strata(sned_yr) idcluster(newclusterid) usevalid reps(500) //holm
		
matrix RW=e(RW)		

matrix list RW

foreach v of numlist 1(1)24{ // each variable is a row in RW

scalar rw_pv=RW[`v',3]
scalar h_pv =RW[`v',4]
estadd scalar rw_pv : est`v'
estadd scalar h_pv :  est`v' 

}
				
				
				
local sample="all"
esttab est1 est2 est3 est4 est5 est6 est7 est8  using "$output_dir/post_s_main_`sample'.tex", tex nolines fragment label replace  collabels(none) nomtitles nonumbers star(* 0.10 ** 0.05 *** 0.01) ///
cells(b(star fmt(3)) se(par(( )) fmt(3)) ) ///
keep(treat25 treat10) ///
stats(N r2   rw_pv , fmt(0 3 3 3)  ///
labels(`"Observations"' `"R-squared"'   `"Romano-Wolf p-value"' ))


local sample="pv"
esttab  est9 est10 est11 est12 est13 est14 est15 est16 using "$output_dir/post_s_main_`sample'.tex", tex nolines fragment label replace  collabels(none) nomtitles nonumbers star(* 0.10 ** 0.05 *** 0.01) ///
cells(b(star fmt(3)) se(par(( )) fmt(3)) ) ///
keep(treat25 treat10) ///
stats(N r2   rw_pv , fmt(0 3 3 3)  ///
labels(`"Observations"' `"R-squared"'   `"Romano-Wolf p-value"' ))



local sample="mv"
esttab est17 est18 est19 est20  est21 est22 est23 est24 using "$output_dir/post_s_main_`sample'.tex", tex nolines fragment label replace  collabels(none) nomtitles nonumbers star(* 0.10 ** 0.05 *** 0.01) ///
cells(b(star fmt(3)) se(par(( )) fmt(3)) ) ///
keep(treat25 treat10) ///
stats(N r2   rw_pv , fmt(0 3 3 3)  ///
labels(`"Observations"' `"R-squared"'   `"Romano-Wolf p-value"' ))


eststo clear

				
				
				
				
				
				
				

	
	
	

